package com.sc.nft.admin.controller;


import com.sc.nft.annotation.SysMemberLogin;
import com.sc.nft.dto.CollectionChipInfoPageDTO;
import com.sc.nft.dto.CollectionChipInfoRecordPageDTO;
import com.sc.nft.entity.vo.CollectionChipInfoPageVO;
import com.sc.nft.entity.vo.CollectionChipInfoRecordPageVO;
import com.sc.nft.service.CollectionChipInfoService;
import com.sc.nft.sup.PageResult;
import com.sc.nft.sup.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;


@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/admin/collection/chipInfo")
@Api(tags = "芯片程序明细")
public class CollectionChipInfoController {
    private final CollectionChipInfoService collectionChipInfoService;

    @PostMapping(value = "/page", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "芯片写入列表", notes = "芯片写入列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public PageResult<CollectionChipInfoPageVO> page(@Valid @RequestBody CollectionChipInfoPageDTO pageDTO) {
        return PageResult.success(collectionChipInfoService.page(pageDTO));
    }



    @PostMapping(value = "/recordPage", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "芯片识别列表", notes = "芯片识别列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public PageResult<CollectionChipInfoRecordPageVO> recordPage(@Valid @RequestBody CollectionChipInfoRecordPageDTO pageDTO) {
        return PageResult.success(collectionChipInfoService.recordPage(pageDTO));
    }

    @PostMapping(value = "/export", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "芯片信息导出", notes = "芯片信息导出", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result<List<String>> export(@Valid @RequestBody CollectionChipInfoPageDTO pageDTO) {
        return Result.success(collectionChipInfoService.export(pageDTO));
    }


}
